﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RCSoft.Core.Data;
using RCSoft.Core;

namespace RCSoft.Data
{
    public partial class EfDataProviderManager:BaseDataProviderManager 
    {
        public EfDataProviderManager(DataSettings settings)
            : base(settings)
        { }

        public override IDataProvider LoadDataProvider()
        {
            var providerName = Settings.DataProvider;
            if (String.IsNullOrWhiteSpace(providerName))
                throw new RCSoftException("数据连接配置中不存在数据连接类型!");
            switch (providerName.ToLowerInvariant())
            { 
                case "sqlserver":
                    return new SqlServerDataProvider();
                case "sqlce":
                    return new SqlServerDataProvider();
                default:
                    throw new RCSoftException(string.Format("不支持数据连接类型为：{0}", providerName));
            }
        }
    }
}
